package com.googlecode.garbagecan.simonstudy;

import org.javasimon.SimonManager;
import org.javasimon.Split;
import org.javasimon.Stopwatch;

public class Test2 {
	public static void main(String[] args) {
		Stopwatch stopwatch = SimonManager.getStopwatch(Test2.class.getName());
		for (int i = 0; i < 10; i++) {
			test();
		}
		System.out.println(stopwatch);
		System.out.println(stopwatch.sample());
	}

	private static void test() {
		Split split = SimonManager.getStopwatch(Test2.class.getName()).start();
		long random = (long) (Math.random() * 1000);
		try {
			Thread.sleep(random);
		} catch (InterruptedException ex) {
			ex.printStackTrace();
		}
		split.stop();
	}
}
